package game.web.controller;

import game.web.base.Constants;
import game.web.dao.dto.TicketDTO;
import game.web.entity.TicketEntityManager;
import game.web.struts.TicketSearchForm;
import projectx.core.base.ProjectXSystemException;
import projectx.core.base.ProjectXUserException;
import projectx.transaction.TransactionHandler;
import projectx.web.base.ProjectXDbTrxController;
import projectx.web.base.ProjectXForm;
import projectx.web.base.UserContext;

public class TicketControllor extends ProjectXDbTrxController {

	protected TicketControllor(UserContext uc, ProjectXForm form) {
		super(uc, form);
	}

	@Override
	public Object execute() throws ProjectXUserException, ProjectXSystemException {

		System.err.println("Controllor start...");
		
		debugBegin();

		UserContext uc = getUc();

		TicketSearchForm form = (TicketSearchForm) getForm();

		String seqid = form.getSeqid();

		TicketDTO dto = TicketEntityManager.execute(seqid);

		uc.put(Constants.TICKET_SEARCH_ACION, dto);

		debugEnd();
		return null;
	}

	public static Object execute(UserContext uc, ProjectXForm form)
			throws ProjectXUserException, ProjectXSystemException {
		return TransactionHandler.call(new TicketControllor(uc, form));
	}
}
